package com.thread;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;

/**
 * Description:
 *
 * @author jiangbang
 * @version 1.0
 * @date: 2018年01月11日
 * @since JDK 1.8
 */
public class ListThread implements Callable<List<Integer>> {
    private List<Integer> idList;
    private List<Integer> threadList;

    public ListThread(List<Integer> idList) {
        this.idList = idList;
        this.threadList = new ArrayList<>();
    }



    /**
     * 任务的具体过程，一旦任务传给ExecutorService的submit方法， 
     * 则该方法自动在一个线程上执行 
     */
    @Override
    public List<Integer> call() throws Exception {
		System.out.println("call()方法被自动调用！！！    " + Thread.currentThread().getName());
        threadList.addAll(idList);
		return threadList;
    }
}
